﻿<UserControl x:Class="Project.SearchComplaint" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" 
             xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" d:DesignHeight="365" d:DesignWidth="750" xmlns:my1="clr-namespace:CustomControls;assembly=CustomControls">
    <UserControl.Resources>
        <DataTemplate x:Key="ABItemsTemplate">
            <Border Width="175" BorderBrush="#69810E" BorderThickness="0,0,0,1">
                <StackPanel>
                    <TextBlock Text="{Binding FullName}">
                    </TextBlock>
                    <TextBlock FontSize="9" Text="{Binding CiPassport, StringFormat='Ci: {0}'}" />
                </StackPanel>
            </Border>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid Height="36" Margin="11,11,56,0" Name="gridTitle"  VerticalAlignment="Top">
            <Border BorderBrush="#5C5C5C" BorderThickness="0,0,0,2">
                <TextBlock FontSize="24" FontWeight="Normal" Text="Buscar Denuncia" Width="711" HorizontalAlignment="Left" ></TextBlock>
            </Border>
        </Grid>
            <Grid Margin="0,48,0,0">
               <StackPanel>
                <Grid Height="30" VerticalAlignment="top" Margin="0,6,0,0">
                    <Label Content="Buscar por Numero de caso:" Height="16" HorizontalAlignment="Left" Margin="29,5,0,0" Name="label10" VerticalAlignment="Top" />
                    <my:AutoCompleteBox HorizontalAlignment="Left" ValueMemberPath="NumberOfCase" Margin="184,2,0,0" FilterMode="StartsWithOrdinal" Name="tbCaseNumber" ItemTemplate="{StaticResource DetailsSearchTemplate}" VerticalAlignment="Top" Width="67" PreviewTextInput="VerifyPreviewNumberTextInput" TextChanged="TbTextChanged" DropDownClosing="tbCasxteNumber_DropDownClosing" />
                </Grid>
                <Expander Name="AdvancedOptions" Header="Otras opciones de búsqueda" Height="25" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="10,10,0,0" Expanded="AdvancedOptions_Expanded" Collapsed="AdvancedOptions_Collapsed">
                    <Grid Name="gridCont">
                        <Label Content="Nombre de la víctima:" Height="26" HorizontalAlignment="Left" Margin="18,33,0,0" Name="label1" VerticalAlignment="Top" />
                        <Label Content="Nombre del agresor:" Height="28" HorizontalAlignment="Left" Margin="18,76,0,0" Name="label2" VerticalAlignment="Top" />
                        <my:AutoCompleteBox FilterMode="StartsWithOrdinal" Height="26" HorizontalAlignment="Left" ItemTemplate="{StaticResource ABItemsTemplate}" Margin="140,30,0,0" MinimumPopulateDelay="0" Name="tbVictimName" ValueMemberPath="FullName" VerticalAlignment="Top" Width="308" DropDownClosing="NameDropDownClosing" PreviewTextInput="VerifyPreviewTextInput" TextChanged="TbTextChanged" />
                        <my:AutoCompleteBox FilterMode="StartsWithOrdinal" Height="26" HorizontalAlignment="Left" ItemTemplate="{StaticResource ABItemsTemplate}" Margin="140,73,0,0" MinimumPopulateDelay="0" Name="tbAggressorName" ValueMemberPath="FullName" VerticalAlignment="Top" Width="308" DropDownClosing="NameDropDownClosing" PreviewTextInput="VerifyPreviewTextInput" TextChanged="TbTextChanged" />
                        <Label Content="C.I. Victima:" Height="28" HorizontalAlignment="Left" Margin="462,33,0,0" Name="label3" VerticalAlignment="Top" />
                        <Label Content="C.I. Agresor:" Height="28" HorizontalAlignment="Left" Margin="462,73,0,0" Name="label5" VerticalAlignment="Top" Width="61" />
                        <my:AutoCompleteBox FilterMode="StartsWithOrdinal" Height="26" HorizontalAlignment="Left" ItemTemplate="{StaticResource ABItemsTemplate}" Margin="529,30,0,0" MinimumPopulateDelay="0" Name="tbVictimCi" ValueMemberPath="CiPassport" VerticalAlignment="Top" Width="133" DropDownClosing="CiDropDownClosing" TextChanged="TbTextChanged" PreviewTextInput="VerifyPreviewNumberTextInput" />
                        <my:AutoCompleteBox FilterMode="StartsWithOrdinal" Height="26" HorizontalAlignment="Left" ItemTemplate="{StaticResource ABItemsTemplate}" Margin="529,73,0,0" MinimumPopulateDelay="0" Name="tbAggressorCi" ValueMemberPath="CiPassport" VerticalAlignment="Top" Width="133" DropDownClosing="CiDropDownClosing" PreviewTextInput="VerifyPreviewNumberTextInput" TextChanged="TbTextChanged" />
                            <Label Content="Buscar por:" Height="28" HorizontalAlignment="Left" Margin="18,6,0,0" Name="label7" VerticalAlignment="Top" />
                        <RadioButton Content="Nombre" GroupName="ByWhat" Height="16" HorizontalAlignment="Left" Margin="83,6,0,0" Name="rbtnByName" VerticalAlignment="Top" Checked="rbtnByName_Checked" />
                        <RadioButton Content="C.I." GroupName="ByWhat" Height="16" HorizontalAlignment="Left" Margin="150,6,0,0" Name="rbtnByCi" VerticalAlignment="Top" Checked="rbtnByCi_Checked" />
                        <Label Content="Seleccionar rango de fechas de registro de denuncia: Del" Height="28" HorizontalAlignment="Left" Margin="18,156,0,0" Name="label8" ToolTip="Esto es opcional, si quiere puede seleccionar un rango de fechas para la busqueda" VerticalAlignment="Top" />
                        <DatePicker Height="28" HorizontalAlignment="Left" Margin="324,152,0,0" Name="dtStart" ToolTip="Esto es opcional, si quiere puede seleccionar un rango de fechas para la busqueda" VerticalAlignment="Top" Width="115" SelectedDateChanged="dtStart_SelectedDateChanged" />
                        <Label Content="Al" Height="28" HorizontalAlignment="Left" Margin="445,156,0,0" Name="label9" ToolTip="Esto es opcional, si quiere puede seleccionar un rango de fechas para la busqueda" VerticalAlignment="Top" />
                        <DatePicker Height="28" HorizontalAlignment="Left" Margin="462,152,0,0" Name="dtEnd" ToolTip="Esto es opcional, si quiere puede seleccionar un rango de fechas para la busqueda" VerticalAlignment="Top" Width="115" SelectedDateChanged="dtEnd_SelectedDateChanged" />
                        <Button Content="Sin rango de fechas" Height="26" HorizontalAlignment="Left" Margin="587,152,0,0" Name="btnResetDates" ToolTip="Resetea las fechas del rango" VerticalAlignment="Top" Width="120" Click="btnResetDates_Click" />
                            <Label Content="Nombre del denunciante:" Height="28" HorizontalAlignment="Left" Margin="18,117,0,0" Name="label4" VerticalAlignment="Top" />
                            <my:AutoCompleteBox FilterMode="StartsWithOrdinal" Height="26" HorizontalAlignment="Left" ItemTemplate="{StaticResource ABItemsTemplate}" Margin="161,114,0,0" MinimumPopulateDelay="0" Name="tbCopmlainantName" ValueMemberPath="FullName" VerticalAlignment="Top" Width="287" DropDownClosing="NameDropDownClosing" PreviewTextInput="VerifyPreviewTextInput" TextChanged="TbTextChanged" />
                            <Label Content="C.I. Denunciante:" Height="28" HorizontalAlignment="Left" Margin="462,117,0,0" Name="label6" VerticalAlignment="Top" />
                            <my:AutoCompleteBox FilterMode="StartsWithOrdinal" Height="26" HorizontalAlignment="Left" ItemTemplate="{StaticResource ABItemsTemplate}" Margin="556,114,0,0" MinimumPopulateDelay="0" Name="tbComplainantCi" ValueMemberPath="CiPassport" VerticalAlignment="Top" Width="106" DropDownClosing="CiDropDownClosing" PreviewTextInput="VerifyPreviewNumberTextInput" TextChanged="TbTextChanged" />
                        </Grid>
                </Expander>
                <ListView Height="200" HorizontalAlignment="Left" ItemContainerStyle="{DynamicResource ListViewSearchContainerStyle}" ItemsSource="{Binding}" Margin="29,10,0,20" Name="listViewComplaints" VerticalAlignment="Top" Width="679" MouseDoubleClick="listViewComplaints_MouseUp">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn CellTemplate="{StaticResource VictimSearchTemplate}" Header="Víctima" Width="180" />
                            <GridViewColumn CellTemplate="{StaticResource AggressorSearchTemplate}" Header="Agresor" Width="180" />
                            <GridViewColumn CellTemplate="{StaticResource InformerSearchTemplate}" Header="Denunciante" Width="180" />
                            <GridViewColumn CellTemplate="{StaticResource DetailsSearchTemplate}" Header="Detalles" Width="130" />
                        </GridView>
                    </ListView.View>
                </ListView>
                </StackPanel>
            </Grid> 
    </Grid>
</UserControl>